<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var n = prompt('キロを入力して、価格を見積もりやすくしてください');
        var car = (function () {
            var start = 13
            var total = 0
            return {
                price: function (n) {
                    if (n <= 3) {
                        total = start
                    } else {
                        total = start + (n - 3)*5
                    }
                    return total
                },
                yd: function (flag) {
                    return flag ? total + 10 : 10
                }
            }
        })();
        alert('あなたの車代の合計は' + car.price(n))
    </script>
</body>

</html>